#include "e2d/imgui/physics/Editor.h"
#include "e2d/core/physics/components.h"

using Editor = e2d::BasicEditor;

template<>
bool Editor::Edit<e2d::PxMaterialData>(const std::string& l, e2d::PxMaterialData& e)
{
	EditInst<float>("m_StaticFriction", e.m_StaticFriction );
	EditInst<float>("m_DynamicFriction", e.m_DynamicFriction );
	EditInst<float>("m_Restitution", e.m_Restitution );
	return false;
}

template<>
bool Editor::Edit<e2d::PxBasicMap>(const std::string& l, e2d::PxBasicMap& e)
{
	EditInst<e2d::PxMaterialData>("m_MaterialData", e.m_MaterialData);
	EditInst<e2d::Transform>("m_LocalPos", e.m_LocalPos);

	return false;
}


template<>
bool Editor::Edit<e2d::PxBoxShapeMap>(const std::string& l, e2d::PxBoxShapeMap& e)
{
	EditInst<e2d::PxBasicMap>("", e);

	EditInst<e2d::BoxShape>("m_Box", e.m_Box);
	return false;
}

template<>
bool Editor::Edit<e2d::PxShapeMap>(const std::string& l, e2d::PxShapeMap& e)
{
	ImGui::Text(l.c_str());
	EditInstList<e2d::PxBoxShapeMap>("boxShapes", e.m_BoxShapes);

	if (ImGui::Button("+"))
	{
		e.m_BoxShapes.push_back({});
	};
	
	return false;
}